Skip to contentSkip to conversation

Change in openvpn[master]: test_packet_id: Add a check after malloc to ensure value is valid

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Apr 5 – Apr 6 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1775426608000.I64da2328591ef2b9ee7502e574c878651cdf356a@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1621?usp=email

to review the following change.

Change subject: test_packet_id: Add a check after malloc to ensure value is valid
......................................................................

test_packet_id: Add a check after malloc to ensure value is valid

cppcheck complains about a potential null pointer dereference in reliable_get_num_output_sequenced_available. That is mostly theoretical, but still add a check.

Change-Id I64da2328591ef2b9ee7502e574c878651cdf356a

---
M tests/unit_tests/openvpn/test_packet_id.c

1 file changed, 1 insertion(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1621/1

tests/unit_tests/openvpn/test_packet_id.c +1 -0
index b7538bd..5dfd319 100644
@@ -164,6 +164,7 @@
 test_get_num_output_sequenced_available(void **state)
 {
     struct reliable *rel = malloc(sizeof(struct reliable));
+    assert_non_null(rel);
     reliable_init(rel, 100, 50, 8, false);
 
     rel->array[5].active = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1621?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I64da2328591ef2b9ee7502e574c878651cdf356a
Gerrit-Change-Number: 1621
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1621?usp=email )

Change subject: test_packet_id: Add a check after malloc to ensure value is valid
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1621?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I64da2328591ef2b9ee7502e574c878651cdf356a
Gerrit-Change-Number: 1621
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 06 Apr 2026 07:47:13 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 test_packet_id: Add a check after malloc to ensure value is valid

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

cppcheck complains about a potential null pointer dereference in reliable_get_num_output_sequenced_available. That is mostly theoretical, but still add a check.

Change-Id I64da2328591ef2b9ee7502e574c878651cdf356a

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1621
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1621
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

tests/unit_tests/openvpn/test_packet_id.c +1 -0
index b7538bd..5dfd319 100644
@@ -164,6 +164,7 @@
 test_get_num_output_sequenced_available(void **state)
 {
     struct reliable *rel = malloc(sizeof(struct reliable));
+    assert_non_null(rel);
     reliable_init(rel, 100, 50, 8, false);
 
     rel->array[5].active = true;
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: test_packet_id: Add a check after malloc to ensure value is valid

That's an easy one - test code, no dependencies on other patches, and tests itself :-)

Your patch has been applied to the master branch.

commit cdb0fbde266a3c3013c1354a985e82c33db8dcdb

Author: Frank Lichtenheld
Date:   Mon Apr 6 09:47:24 2026 +0200
     test_packet_id: Add a check after malloc to ensure value is valid

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1621
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg36516.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1621?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: test_packet_id: Add a check after malloc to ensure value is valid
......................................................................

test_packet_id: Add a check after malloc to ensure value is valid

cppcheck complains about a potential null pointer dereference in reliable_get_num_output_sequenced_available. That is mostly theoretical, but still add a check.

Change-Id I64da2328591ef2b9ee7502e574c878651cdf356a

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1621
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36516.html

---
M tests/unit_tests/openvpn/test_packet_id.c

1 file changed, 1 insertion(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1621/2

tests/unit_tests/openvpn/test_packet_id.c +1 -0
index b7538bd..5dfd319 100644
@@ -164,6 +164,7 @@
 test_get_num_output_sequenced_available(void **state)
 {
     struct reliable *rel = malloc(sizeof(struct reliable));
+    assert_non_null(rel);
     reliable_init(rel, 100, 50, 8, false);
 
     rel->array[5].active = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1621?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I64da2328591ef2b9ee7502e574c878651cdf356a
Gerrit-Change-Number: 1621
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1621?usp=email )

Change subject: test_packet_id: Add a check after malloc to ensure value is valid
......................................................................

test_packet_id: Add a check after malloc to ensure value is valid

cppcheck complains about a potential null pointer dereference in reliable_get_num_output_sequenced_available. That is mostly theoretical, but still add a check.

Change-Id I64da2328591ef2b9ee7502e574c878651cdf356a

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1621
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36516.html

---
M tests/unit_tests/openvpn/test_packet_id.c

1 file changed, 1 insertion(+), 0 deletions(-)
tests/unit_tests/openvpn/test_packet_id.c +1 -0
index b7538bd..5dfd319 100644
@@ -164,6 +164,7 @@
 test_get_num_output_sequenced_available(void **state)
 {
     struct reliable *rel = malloc(sizeof(struct reliable));
+    assert_non_null(rel);
     reliable_init(rel, 100, 50, 8, false);
 
     rel->array[5].active = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1621?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I64da2328591ef2b9ee7502e574c878651cdf356a
Gerrit-Change-Number: 1621
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>